package com.ybear.ybutils.utils.dialog;

import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.view.Gravity;

import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;

import com.ybear.ybutils.utils.R;

public class DialogInit {
    private int buttonLayoutLeftPadding = 0;        //按钮父布局右边的内边距
    private int buttonLayoutTopPadding = 0;         //按钮父布局底部的内边距
    private int buttonLayoutRightPadding = 4;       //按钮父布局右边的内边距
    private int buttonLayoutBottomPadding = 10;     //按钮父布局底部的内边距

    private int buttonPadding = 10;                 //按钮的内边距
    private int buttonRightMargin = 14;             //按钮右边的外边距

    private int defTextSize = 14;                   //默认字体大小
    private int defTitleTextSize = 20;              //默认标题大小

    private int defTitleLeftPadding = 14;           //默认标题左边的内边距
    private int defTitleTopPadding = 14;            //默认标题顶部的内边距
    private int defTitleRightPadding = 14;          //默认标题右边的内边距
    private int defTitleBottomPadding = 0;          //默认标题底部的内边距

    private int defMessageLeftPadding = 20;         //默认消息内容左边的内边距
    private int defMessageTopPadding = 4;           //默认消息内容顶部的内边距
    private int defMessageRightPadding = 20;        //默认消息内容右边的内边距
    private int defMessageBottomPadding = 14;       //默认消息内容底部的内边距


    @ColorInt
    private int defTextBackgroundColor = 0;
    private Drawable defTextBackground = null;
    @DrawableRes
    private int defTextBackgroundRes = 0;
    private int defTextUnit = TypedValue.COMPLEX_UNIT_SP;

    @ColorRes
    private int defTextColor = R.color.colorPrimary;
    @ColorInt
    private int defTextColorInt = -1;
    @ColorRes
    private int defTitleColor = R.color.colorPrimary;
    @ColorInt
    private int defTitleColorInt = -1;

    private Typeface defTextTypeface = null;
    private int defTextStyle = 0;
    private int defTextGravity = Gravity.NO_GRAVITY;
    private int[] defTextPaddings;
    private int defTextMaxLines = -1;

    private DialogInit() {}
    public static DialogInit get() { return HANDLER.I; }
    private static final class HANDLER { private static final DialogInit I = new DialogInit(); }

    public DialogInit setButtonLayoutPadding(int l, int t, int r, int b) {
        buttonLayoutLeftPadding = l;
        buttonLayoutTopPadding = t;
        buttonLayoutRightPadding = r;
        buttonLayoutBottomPadding = b;
        return this;
    }

    public int getButtonLayoutLeftPadding() { return buttonLayoutLeftPadding; }
    public DialogInit setButtonLayoutLeftPadding(int buttonLayoutLeftPadding) {
        this.buttonLayoutLeftPadding = buttonLayoutLeftPadding;
        return this;
    }

    public int getButtonLayoutTopPadding() { return buttonLayoutTopPadding; }
    public DialogInit setButtonLayoutTopPadding(int buttonLayoutTopPadding) {
        this.buttonLayoutTopPadding = buttonLayoutTopPadding;
        return this;
    }

    public int getButtonLayoutRightPadding() { return buttonLayoutRightPadding; }
    public DialogInit setButtonLayoutRightPadding(int buttonLayoutRightPadding) {
        this.buttonLayoutRightPadding = buttonLayoutRightPadding;
        return this;
    }

    public int getButtonLayoutBottomPadding() { return buttonLayoutBottomPadding; }
    public DialogInit setButtonLayoutBottomPadding(int buttonLayoutBottomPadding) {
        this.buttonLayoutBottomPadding = buttonLayoutBottomPadding;
        return this;
    }

    public int getButtonPadding() { return buttonPadding; }
    public DialogInit setButtonPadding(int buttonPadding) {
        this.buttonPadding = buttonPadding;
        return this;
    }

    public int getButtonRightMargin() { return buttonRightMargin; }
    public DialogInit setButtonRightMargin(int buttonRightMargin) {
        this.buttonRightMargin = buttonRightMargin;
        return this;
    }

    public int getDefTextSize() { return defTextSize; }
    public DialogInit setDefTextSize(int defTextSize) {
        this.defTextSize = defTextSize;
        return this;
    }

    public int getDefTitleTextSize() { return defTitleTextSize; }
    public DialogInit setDefTitleTextSize(int defTitleTextSize) {
        this.defTitleTextSize = defTitleTextSize;
        return this;
    }

    public DialogInit setDefTitlePadding(int l, int t, int r, int b) {
        defTitleLeftPadding = l;
        defTitleTopPadding = t;
        defTitleRightPadding = r;
        defTitleBottomPadding = b;
        return this;
    }

    public int getDefTitleLeftPadding() { return defTitleLeftPadding; }
    public DialogInit setDefTitleLeftPadding(int defTitleLeftPadding) {
        this.defTitleLeftPadding = defTitleLeftPadding;
        return this;
    }

    public int getDefTitleTopPadding() { return defTitleTopPadding; }
    public DialogInit setDefTitleTopPadding(int defTitleTopPadding) {
        this.defTitleTopPadding = defTitleTopPadding;
        return this;
    }

    public int getDefTitleRightPadding() { return defTitleRightPadding; }
    public DialogInit setDefTitleRightPadding(int defTitleRightPadding) {
        this.defTitleRightPadding = defTitleRightPadding;
        return this;
    }

    public int getDefTitleBottomPadding() { return defTitleBottomPadding; }
    public DialogInit setDefTitleBottomPadding(int defTitleBottomPadding) {
        this.defTitleBottomPadding = defTitleBottomPadding;
        return this;
    }


    public DialogInit setDefMessagePadding(int l, int t, int r, int b) {
        defMessageLeftPadding = l;
        defMessageTopPadding = t;
        defMessageRightPadding = r;
        defMessageBottomPadding = b;
        return this;
    }

    public int getDefMessageLeftPadding() { return defMessageLeftPadding; }
    public DialogInit setDefMessageLeftPadding(int defMessageLeftPadding) {
        this.defMessageLeftPadding = defMessageLeftPadding;
        return this;
    }

    public int getDefMessageTopPadding() { return defMessageTopPadding; }
    public DialogInit setDefMessageTopPadding(int defMessageTopPadding) {
        this.defMessageTopPadding = defMessageTopPadding;
        return this;
    }

    public int getDefMessageRightPadding() { return defMessageRightPadding; }
    public DialogInit setDefMessageRightPadding(int defMessageRightPadding) {
        this.defMessageRightPadding = defMessageRightPadding;
        return this;
    }

    public int getDefMessageBottomPadding() { return defMessageBottomPadding; }
    public DialogInit setDefMessageBottomPadding(int defMessageBottomPadding) {
        this.defMessageBottomPadding = defMessageBottomPadding;
        return this;
    }

    @ColorInt
    public int getDefTextBackgroundColor() { return defTextBackgroundColor; }
    public DialogInit setDefTextBackgroundColor(@ColorInt int defTextBackgroundColor) {
        this.defTextBackgroundColor = defTextBackgroundColor;
        return this;
    }

    public Drawable getDefTextBackground() { return defTextBackground; }
    public DialogInit setDefTextBackground(Drawable defTextBackground) {
        this.defTextBackground = defTextBackground;
        return this;
    }

    @DrawableRes
    public int getDefTextBackgroundRes() { return defTextBackgroundRes; }
    public DialogInit setDefTextBackgroundRes(@DrawableRes int defTextBackgroundRes) {
        this.defTextBackgroundRes = defTextBackgroundRes;
        return this;
    }

    public int getDefTextUnit() { return defTextUnit; }
    public DialogInit setDefTextUnit(int defTextUnit) {
        this.defTextUnit = defTextUnit;
        return this;
    }

    @ColorRes
    public int getDefTextColor() { return defTextColor; }
    public DialogInit setDefTextColor(@ColorRes int defTextColor) {
        this.defTextColor = defTextColor;
        return this;
    }

    @ColorInt
    public int getDefTextColorInt() { return defTextColorInt; }
    public DialogInit setDefTextColorInt(@ColorInt int defTextColorInt) {
        this.defTextColorInt = defTextColorInt;
        return this;
    }

    @ColorRes
    public int getDefTitleColor() { return defTitleColor; }
    public DialogInit setDefTitleColor(@ColorRes int defTitleColor) {
        this.defTitleColor = defTitleColor;
        return this;
    }

    @ColorInt
    public int getDefTitleColorInt() { return defTitleColorInt; }
    public DialogInit setDefTitleColorInt(@ColorInt int defTitleColorInt) {
        this.defTitleColorInt = defTitleColorInt;
        return this;
    }

    public Typeface getDefTextTypeface() { return defTextTypeface; }
    public DialogInit setDefTextTypeface(Typeface defTextTypeface) {
        this.defTextTypeface = defTextTypeface;
        return this;
    }

    public int getDefTextStyle() { return defTextStyle; }
    public DialogInit setDefTextStyle(int defTextStyle) {
        this.defTextStyle = defTextStyle;
        return this;
    }

    public int getDefTextGravity() { return defTextGravity; }
    public DialogInit setDefTextGravity(int defTextGravity) {
        this.defTextGravity = defTextGravity;
        return this;
    }

    public int[] getDefTextPaddings() { return defTextPaddings; }
    public DialogInit setDefTextPaddings(int left, int top, int right, int bottom) {
        defTextPaddings = new int[] { left, top, right, bottom };
        return this;
    }
    public DialogInit setDefTextPaddings(int[] defTextPaddings) {
        this.defTextPaddings = defTextPaddings;
        return this;
    }

    public int getDefTextMaxLines() { return defTextMaxLines; }

    public DialogInit setDefTextMaxLines(int defTextMaxLines) {
        this.defTextMaxLines = defTextMaxLines;
        return this;
    }
}
